Skip to main content

Last Update: 2025/3/26

Qwen Speech API 【Deprecate】

The Qwen Speech API allows you to convert text to speech using OpenAI's SDK. This document provides an overview of the API endpoints, request parameters, and response structure.

Endpoint

POST https://platform.llmprovider.ai/v1/audio/speech

Request Headers

HeaderValue
AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

Request Body

The request body should be a JSON object with the following parameters:

ParameterTypeDescription
modelstringThe model to use (e.g., qwen2-audio-instruct).
inputstringThe text to generate audio for. The maximum length is 4096 characters.
voicestringThe voice to use (alloy, echo, fable, onyx, nova, or shimmer).
response_formatstring(Optional) The format of the audio response (mp3, opus, aac, or flac).
speednumber(Optional) The speed of the generated audio. Select a value from 0.25 to 4.0. 1.0 is the default.

Example Request

{
"model": "qwen2-audio-instruct",
"input": "Hello, how are you today?",
"voice": "alloy",
"response_format": "mp3",
"speed": 1.0
}

Response

The API returns an audio file in the requested format.

Example Request

curl -X POST https://platform.llmprovider.ai/v1/audio/speech \
-H "Authorization: Bearer $YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen2-audio-instruct",
"input": "Hello, how are you today?",
"voice": "alloy"
}' \
--output speech.mp3

For any questions or further assistance, please contact us at [email protected].